package com.example.appbarlayoutdemo.fragment;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.appbarlayoutdemo.R;
import com.example.appbarlayoutdemo.adapter.ShopClassifyAdapter;
import com.example.appbarlayoutdemo.base.BaseFragment;
import com.example.appbarlayoutdemo.bean.DataListBean;
import com.example.appbarlayoutdemo.weight.DividerDecoration;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * @author: njb
 * @date: 2020/3/31 0031 22:11
 * @desc:
 */
public class ShopClassifyFragment extends BaseFragment {
    private ShopClassifyAdapter classifyAdapter;
    @BindView(R.id.rv_classify)
    RecyclerView rvClassify;
    private List<DataListBean> mList;


    @Override
    protected void loadData() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.fm_shop_classify;
    }

    @Override
    protected void initView() {
        initAdapter();
    }

    private void initAdapter() {
        mList = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            DataListBean dataListBean = new DataListBean();
            dataListBean.setPictureUrl("");
            dataListBean.setSellingPrice("36500");
            dataListBean.setGoodsName("黄色方领女士连衣裙");
            dataListBean.setBrandNameEn("MAX STUDIO");
            dataListBean.setOfficialPrice("14520");
            mList.add(dataListBean);
        }
        classifyAdapter = new ShopClassifyAdapter(mList);
        rvClassify.setLayoutManager(new GridLayoutManager(context,2));
        //rvClassify.addItemDecoration(new DividerDecoration(this.getResources().getColor(R.color.white), 20));
        rvClassify.setAdapter(classifyAdapter);
    }

    @Override
    protected void addListener() {

    }
}
